import { login} from "@/api/index";
import { resetRouter } from "@/router";
const getDefaultState = () => {
  return {
    token: 1,
    name: "",
    avatar: "",
    userId: "",
    userType: "",
  };
};

const state = getDefaultState();

const mutations = {
 
};

const actions = {
  // user login
  login({ commit }, data) {
    return new Promise((resolve, reject) => {
      login(data)
        .then((res) => {
         console.log(res);
          resolve(res);
        }).catch((error) => {
       
          reject(error);
        });
    });
  }
};

export default {
  namespaced: true,
  state,
  mutations,
  actions,
};
